#include "widget.h"
#include "ui_widget.h"

#include <QKeyEvent>
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::keyPressEvent(QKeyEvent *event)
{
    //qDebug() << event->key();
    //Qt中把搭配组合键的功能键单独拎出来,为modifiers(修饰符)
    if(event->key() == Qt::Key_A && event->modifiers() == Qt::ControlModifier){
        qDebug() << "按下了Ctrl + A键";
    }
}

